import React, { Component } from 'react'
import { Button, Form, Switch, Select, Radio, Checkbox, Badge, InputNumber, message } from 'antd'
import constant from "../constant";
import { deepFullCopy, messages } from "share/common";
import Priority from "components/template/priority";
import Condition from 'components/condition'
import SaveHoc from "./save-hoc";
import WrapFormItem from "components/wrap-form-item";
import CompactInput from "components/compact-input";
import ResizeTable from "components/resize-table/resize-table";
import RecheckModal from "./recheck-modal";

class PayBasicRule extends Component {

  state = {
    priority: null,
    saveLoading: false,
    data: [],
    loanMaxRecord: {},
    visible: false
  };

  componentWillMount() {
    const { record } = this.props.params;
    this.setState({
      priority: record.id ? {
        levelOrgName: record.levelOrgName,
        levelOrgId: record.levelOrgId,
        distribution: record.isGlobal ? null : {
          companies: record.fmPaymentOptionDistList.map(item => { return { name: item.levelOrgName, id: item.levelOrgId } })
        }
      } : null,
      data: deepFullCopy((record.payCheckConditionList || []).map(item => {
        item.frontId = this.getRandomId();
        return item
      }))
    })
  };

  handleSave = () => {
    this.props.form.validateFieldsAndScroll((err, value) => {
      if (!err) {
        const { data } = this.state;
        value.defPaymentMethods = [value.defPaymentMethods];
        value.payCheckConditionList = data;
        value = Object.assign(value, value.partner);
        value = Object.assign(value, value.payeeAccount);
        value = Object.assign(value, value.payeeAccountStatus);
        value = Object.assign(value, value.planPayDate);
        value = Object.assign(value, value.repaymentRisk);
        if (value.repaymentRiskTip.length && !value.repaymentRiskDay) {
          message.error(messages('finance-1.key534')/*重复付款风险提示必填*/);
          return -1
        }
        delete value.payeeAccount;
        delete value.partner;
        delete value.repaymentRisk;
        this.props.handleSave('savePayBasicRule', value, 'fmPaymentOptionDistList');
      }
    })
  };

  handlePriority = value => {
    this.setState({ priority: value });
  };

  handleAddLoanMax = record => {
    this.setState({ loanMaxRecord: record }, () => {
      this.setState({ visible: true });
    })
  };

  getRandomId = () => {
    const { data } = this.state;
    let id = Math.ceil(Math.random() * 100000);
    if (!data.find(item => item.frontId === id)) {
      return id;
    } else {
      this.getRandomId();
    }
  };

  controlOption = [
    { key: '0', label: messages('finance-1.key397')/*不管控*/ },
    { key: '1', label: messages('finance-1.key398')/*强管控*/ },
    { key: '2', label: messages('finance-1.key399')/*弱管控*/ }
  ];

  statusOption = [
    { key: '1', label: messages('finance-1.key116')/*线上*/ },
    { key: '2', label: messages('finance-1.key117')/*线下*/ },
    { key: '4', label: messages('finance-1.key118')/*落地文件*/ }
  ];

  onOk = value => {
    const { data } = this.state;
    data.deleteObj(value, 'frontId');
    data.addIfNotExistObj(value, 'frontId');
    this.setState({ data, visible: false });
  };

  render() {
    const { getFieldDecorator } = this.props.form;
    const { saveLoading, priority, data, loanMaxRecord, visible } = this.state;
    const { formItemLayout } = constant;
    const { close } = this.props, { record } = this.props.params;
    return (
      <div>
        <Form className={'new-form'}>
          <Condition>
            <Condition.If value={record.onlyRead}>
              <h3 className='sub-title' style={{marginTop: '0'}}>{messages('finance-1.key400')/*付款工作台*/}</h3>
              <Form.Item
                label={messages('finance-1.key259')/*启用付款方式类型*/}
                {...formItemLayout}
                extra={messages('finance-1.key401')/*落地文件类型支付，主要应用于网银支付等支付场景*/}
                required
              >
                <div>
                  <div>{messages('finance-1.key116')/*线上*/}</div>
                  <div className={'ant-form-extra'}>{messages('finance-1.key402')/*线上类型支付，主要应用于银企直联等支付场景*/}</div>
                  <div style={{ marginTop: '16px' }}>{messages('finance-1.key117')/*线下*/}</div>
                  <div className={'ant-form-extra'}>{messages('finance-1.key403')/*线下类型支付，一步确认后即更新为付款成功*/}</div>
                  <div style={{ marginTop: '16px' }}>{messages('finance-1.key118')/*落地文件*/}</div>
                </div>
              </Form.Item>
              <Form.Item
                label={messages('finance-1.key260')/*默认付款方式类型*/}
                {...formItemLayout}
                extra={messages('finance-1.key404')/*付款工作台页签切换时，默认显示的付款方式类型数据*/}
                required
              >
                <div>{messages('finance-1.key118')/*落地文件*/}</div>
              </Form.Item>
              <Form.Item
                label={messages('finance-1.key261')/*部分支付*/}
                {...formItemLayout}
                extra={messages('finance-1.key405')/*付款工作台未支付页签，允许修改本次支付金额*/}
                required
              >
                <div>{messages('finance-1.key244')/*启用temp*/}</div>
              </Form.Item>
              <Form.Item
                label={messages('finance-1.key406')/*银企直联备注*/}
                {...formItemLayout}
                extra={messages('finance-1.key407')/*如启用，银企直联支付时传原单据备注信息（上限50字符，超长会截断，避免超长影响支付）至银行接口用途字段*/}
                required
              >
                <div>{messages('finance-1.key266')/*不启用*/}</div>
              </Form.Item>
              <h3 className='sub-title'>{messages('finance-1.key408')/*付款校验*/}</h3>
              <Form.Item
                label={messages('finance-1.key409')/*跨公司合并付款*/}
                {...formItemLayout}
                extra={messages('finance-1.key410')/*付款工作台确认支付时，不同公司的单据是否允许生成同一个付款批次进行合并付款*/}
                required
              >
                <div>{messages('finance-1.key266')/*不启用*/}</div>
              </Form.Item>
              <Form.Item
                label={messages('finance-1.key411')/*异常数据剔除*/}
                {...formItemLayout}
                extra={messages('finance-1.key412')/*付款工作台确认支付时，若存在强/弱管控的待付数据，对异常数据进行剔除，其余数据正常组成批次支付*/}
                required
              >
                <div>{messages('finance-1.key266')/*不启用*/}</div>
              </Form.Item>
              <Form.Item
                label={messages('finance-1.key413')/*收款方状态*/}
                {...formItemLayout}
                extra={messages('finance-1.key414')/*付款工作台确认支付时，配置的付款方式类型中，付款的待付数据的收款方状态不能离职/禁用，并进行相应的管控*/}
                required
              >
                <div>{messages('finance-1.key398')/*强管控*/}；{messages('finance-1.key116')/*线上*/}</div>
              </Form.Item>
              <Form.Item
                label={messages('finance-1.key368')/*收款账户必填*/}
                {...formItemLayout}
                extra={messages('finance-1.key415')/*付款工作台确认支付时，配置的付款方式类型中，付款的待付数据的收款方账户不能为空，并进行相应的管控*/}
                required
              >
                <div>{messages('finance-1.key398')/*强管控*/}；{messages('finance-1.key116')/*线上*/}</div>
              </Form.Item>
              <Form.Item
                label={messages('finance-1.key416')/*收款账户状态*/}
                {...formItemLayout}
                extra={messages('finance-1.key417')/*付款工作台确认支付时，配置的付款方式类型中，付款的待付数据的收款方账户不能禁用，并进行相应的管控*/}
                required
              >
                <div>{messages('finance-1.key398')/*强管控*/}；{messages('finance-1.key116')/*线上*/}</div>
              </Form.Item>
              <Form.Item
                label={messages('finance-1.key55')/*计划付款日期*/}
                {...formItemLayout}
                extra={messages('finance-1.key418')/*付款工作台确认支付时，配置的付款方式类型中，付款的待付数据的计划付款日期不能晚于当前系统日期，并进行相应的管控*/}
                required
              >
                <div>{messages('finance-1.key397')/*不管控*/}</div>
              </Form.Item>
              <h3 className='sub-title'>{messages('finance-1.key419')/*付款流程管控*/}</h3>
              <Form.Item
                label={messages('finance-1.key262')/*线上付款复核*/}
                {...formItemLayout}
                extra={messages('finance-1.key420')/*线上付款组批后， 需复核通过后，方可进行银企直联/企业支付宝支付*/}
                required
              >
                <div>{messages('finance-1.key266')/*不启用*/}</div>
              </Form.Item>
              <Form.Item
                label={messages('finance-1.key421')/*线上退票复核*/}
                {...formItemLayout}
                extra={messages('finance-1.key422')/*线上支付流水发生退票时，需复核通过后，方标记为付款退票*/}
                required
              >
                <div>{messages('finance-1.key266')/*不启用*/}</div>
              </Form.Item>
            </Condition.If>
            <Condition.Else>
              <Form.Item
                label={messages('common.column.status')/*状态*/}
                {...formItemLayout}
              >
                {getFieldDecorator("isEnablt", {
                  rules: [{ required: true }],
                  valuePropName: "checked",
                  initialValue: record.hasOwnProperty('isEnablt') ? record.isEnablt : true
                })(
                  <Switch>{messages('finance-1.key244')/*启用temp*/}</Switch>
                )}
              </Form.Item>
              <Priority
                top='SET_OF_BOOK'
                disabled={record.hasOwnProperty('id')}
                onChange={this.handlePriority}
                formItemLayout={formItemLayout}
                defaultValue={priority}
                single={false}
                showCompany={false}
                showCompanyComponent={false}
              />
              <h3 className='sub-title'>{messages('finance-1.key400')/*付款工作台*/}</h3>
              <Form.Item
                label={messages('finance-1.key259')/*启用付款方式类型*/}
                {...formItemLayout}
              >
                {getFieldDecorator("ablePaymentMethods", {
                  rules: [{ required: true, message: messages('common.select')/*请选择*/ }],
                  initialValue: record.hasOwnProperty('ablePaymentMethods') ? record.ablePaymentMethods.map(item => item + '') : ['1', '2', '4']
                })(
                  <Checkbox.Group>
                    <Checkbox value='1'>{messages('finance-1.key116')/*线上*/}</Checkbox>
                    <div className='ant-form-extra'>{messages('finance-1.key402')/*线上类型支付，主要应用于银企直联等支付场景*/}</div>
                    <Checkbox value='2' style={{ marginTop: '16px' }}>{messages('finance-1.key117')/*线下*/}</Checkbox>
                    <div className='ant-form-extra'>{messages('finance-1.key403')/*线下类型支付，一步确认后即更新为付款成功*/}</div>
                    <Checkbox value='4' style={{ marginTop: '16px' }}>{messages('finance-1.key118')/*落地文件*/}</Checkbox>
                    <div className='ant-form-extra'>{messages('finance-1.key401')/*落地文件类型支付，主要应用于网银支付等支付场景*/}</div>
                  </Checkbox.Group>
                )}
              </Form.Item>
              <Form.Item
                label={messages('finance-1.key260')/*默认付款方式类型*/}
                {...formItemLayout}
                extra={messages('finance-1.key404')/*付款工作台页签切换时，默认显示的付款方式类型数据*/}
              >
                {getFieldDecorator("defPaymentMethods", {
                  rules: [{ required: true, message: messages('common.select')/*请选择*/ }],
                  initialValue: record.hasOwnProperty('defPaymentMethods') ? record.defPaymentMethods[0] + '' : '4'
                })(
                  <Select placeholder={messages('finance-1.key131')/*请选择temp*/}>
                    {this.statusOption.map(item => <Select.Option key={item.key}>{item.label}</Select.Option>)}
                  </Select>
                )}
              </Form.Item>
              <Form.Item
                label={messages('finance-1.key261')/*部分支付*/}
                {...formItemLayout}
                extra={messages('finance-1.key405')/*付款工作台未支付页签，允许修改本次支付金额*/}
              >
                {getFieldDecorator("isPartPay", {
                  rules: [{ required: true }],
                  initialValue: record.hasOwnProperty('isPartPay') ? record.isPartPay : true
                })(
                  <Radio.Group options={[
                    { label: messages('finance-1.key244')/*启用temp*/, value: true },
                    { label: messages('finance-1.key266')/*不启用*/, value: false }
                  ]}/>
                )}
              </Form.Item>
              <Form.Item
                label={messages('finance-1.key406')/*银企直联备注*/}
                {...formItemLayout}
                extra={messages('finance-1.key407')/*如启用，银企直联支付时传原单据备注信息（上限50字符，超长会截断，避免超长影响支付）至银行接口用途字段*/}
              >
                {getFieldDecorator("isBankPayRemark", {
                  rules: [{ required: true }],
                  initialValue: record.hasOwnProperty('isBankPayRemark') ? record.isBankPayRemark : false
                })(
                  <Radio.Group options={[
                    { label: messages('finance-1.key244')/*启用temp*/, value: true },
                    { label: messages('finance-1.key266')/*不启用*/, value: false }
                  ]}/>
                )}
              </Form.Item>
              <h3 className='sub-title'>{messages('finance-1.key408')/*付款校验*/}</h3>
              <Form.Item
                label={messages('finance-1.key409')/*跨公司合并付款*/}
                {...formItemLayout}
                extra={messages('finance-1.key410')/*付款工作台确认支付时，不同公司的单据是否允许生成同一个付款批次进行合并付款*/}
              >
                {getFieldDecorator("companyCombinedPayment", {
                  rules: [{ required: true }],
                  initialValue: record.hasOwnProperty('companyCombinedPayment') ? record.companyCombinedPayment : false
                })(
                  <Radio.Group options={[
                    { label: messages('finance-1.key244')/*启用temp*/, value: true },
                    { label: messages('finance-1.key266')/*不启用*/, value: false }
                  ]}/>
                )}
              </Form.Item>
              <Form.Item
                label={messages('finance-1.key411')/*异常数据剔除*/}
                {...formItemLayout}
                extra={messages('finance-1.key412')/*付款工作台确认支付时，若存在强/弱管控的待付数据，对异常数据进行剔除，其余数据正常组成批次支付*/}
              >
                {getFieldDecorator("removeExceptionData", {
                  rules: [{ required: true }],
                  initialValue: record.hasOwnProperty('removeExceptionData') ? record.removeExceptionData : false
                })(
                  <Radio.Group options={[
                    { label: messages('finance-1.key244')/*启用temp*/, value: true },
                    { label: messages('finance-1.key266')/*不启用*/, value: false }
                  ]}/>
                )}
              </Form.Item>
              <Form.Item
                label={messages('finance-1.key413')/*收款方状态*/}
                {...formItemLayout}
                extra={messages('finance-1.key414')/*付款工作台确认支付时，配置的付款方式类型中，付款的待付数据的收款方状态不能离职/禁用，并进行相应的管控*/}
              >
                {getFieldDecorator("partner", {
                  rules: [{ required: true }],
                  initialValue: record.hasOwnProperty('partnerStatusControl') ? {
                    partnerStatusControl: record.partnerStatusControl + '',
                    partnerStatus: record.partnerStatus ? record.partnerStatus.map(item => item + '') : []
                  } : {
                    partnerStatusControl: '1',
                    partnerStatus: ['1']
                  }
                })(
                  <WrapFormItem>
                    {(onChange, value) => (
                      <CompactInput>
                        <Select
                          value={value.partnerStatusControl}
                          placeholder={messages('common.select')/*请选择*/}
                          onChange={value => onChange({ partnerStatusControl: value, partnerStatus: [] })}
                        >
                          {this.controlOption.map(item => <Select.Option key={item.key}>{item.label}</Select.Option>)}
                        </Select>
                        <Select
                          mode='multiple'
                          disabled={value.partnerStatusControl === '0'}
                          placeholder={messages('common.select')/*请选择*/}
                          value={value.partnerStatus}
                          onChange={value => onChange({ partnerStatus: value })}
                        >
                          {this.statusOption.map(item => <Select.Option key={item.key}>{item.label}</Select.Option>)}
                        </Select>
                      </CompactInput>
                    )}
                  </WrapFormItem>
                )}
              </Form.Item>
              <Form.Item
                label={messages('finance-1.key368')/*收款账户必填*/}
                {...formItemLayout}
                extra={messages('finance-1.key415')/*付款工作台确认支付时，配置的付款方式类型中，付款的待付数据的收款方账户不能为空，并进行相应的管控*/}
              >
                {getFieldDecorator("payeeAccount", {
                  rules: [{ required: true }],
                  initialValue: record.hasOwnProperty('payeeAccountRequiredControl') ? {
                    payeeAccountRequiredControl: record.payeeAccountRequiredControl + '',
                    payeeAccountRequired: record.payeeAccountRequired ? record.payeeAccountRequired.map(item => item + '') : []
                  } : {
                    payeeAccountRequiredControl: '1',
                    payeeAccountRequired: ['1']
                  }
                })(
                  <WrapFormItem>
                    {(onChange, value) => (
                      <CompactInput>
                        <Select
                          value={value.payeeAccountRequiredControl}
                          placeholder={messages('common.select')/*请选择*/}
                          onChange={value => onChange({ payeeAccountRequiredControl: value, payeeAccountRequired: [] })}
                        >
                          {this.controlOption.map(item => <Select.Option key={item.key}>{item.label}</Select.Option>)}
                        </Select>
                        <Select
                          mode='multiple'
                          disabled={value.payeeAccountRequiredControl === '0'}
                          placeholder={messages('common.select')/*请选择*/}
                          value={value.payeeAccountRequired}
                          onChange={value => onChange({ payeeAccountRequired: value })}
                        >
                          {this.statusOption.map(item => <Select.Option key={item.key}>{item.label}</Select.Option>)}
                        </Select>
                      </CompactInput>
                    )}
                  </WrapFormItem>
                )}
              </Form.Item>
              <Form.Item
                label={messages('finance-1.key416')/*收款账户状态*/}
                {...formItemLayout}
                extra={messages('finance-1.key417')/*付款工作台确认支付时，配置的付款方式类型中，付款的待付数据的收款方账户不能禁用，并进行相应的管控*/}
              >
                {getFieldDecorator("payeeAccountStatus", {
                  rules: [{ required: true }],
                  initialValue: record.hasOwnProperty('payeeAccountStatusControl') ? {
                    payeeAccountStatusControl: record.payeeAccountStatusControl + '',
                    payeeAccountStatus: record.payeeAccountStatus ? record.payeeAccountStatus.map(item => item + '') : []
                  } : {
                    payeeAccountStatusControl: '1',
                    payeeAccountStatus: ['1']
                  }
                })(
                  <WrapFormItem>
                    {(onChange, value) => (
                      <CompactInput>
                        <Select
                          value={value.payeeAccountStatusControl}
                          placeholder={messages('common.select')/*请选择*/}
                          onChange={value => onChange({ payeeAccountStatusControl: value, payeeAccountStatus: [] })}
                        >
                          {this.controlOption.map(item => <Select.Option key={item.key}>{item.label}</Select.Option>)}
                        </Select>
                        <Select
                          mode='multiple'
                          disabled={value.payeeAccountStatusControl === '0'}
                          placeholder={messages('common.select')/*请选择*/}
                          value={value.payeeAccountStatus}
                          onChange={value => onChange({ payeeAccountStatus: value })}
                        >
                          {this.statusOption.map(item => <Select.Option key={item.key}>{item.label}</Select.Option>)}
                        </Select>
                      </CompactInput>
                    )}
                  </WrapFormItem>
                )}
              </Form.Item>
              <Form.Item
                label={messages('finance-1.key55')/*计划付款日期*/}
                {...formItemLayout}
                extra={messages('finance-1.key418')/*付款工作台确认支付时，配置的付款方式类型中，付款的待付数据的计划付款日期不能晚于当前系统日期，并进行相应的管控*/}
              >
                {getFieldDecorator("planPayDate", {
                  rules: [{ required: true }],
                  initialValue: record.hasOwnProperty('planPayDateControl') ? {
                    planPayDateControl: record.planPayDateControl + '',
                    planPayDate: record.planPayDate ? record.planPayDate.map(item => item + '') : []
                  } : {
                    planPayDateControl: '0',
                    planPayDate: []
                  }
                })(
                  <WrapFormItem>
                    {(onChange, value) => (
                      <CompactInput>
                        <Select
                          value={value.planPayDateControl}
                          placeholder={messages('common.select')/*请选择*/}
                          onChange={value => onChange({ planPayDateControl: value, planPayDate: [] })}
                        >
                          {this.controlOption.map(item => <Select.Option key={item.key}>{item.label}</Select.Option>)}
                        </Select>
                        <Select
                          mode='multiple'
                          disabled={value.planPayDateControl === '0'}
                          placeholder={messages('common.select')/*请选择*/}
                          value={value.planPayDate}
                          onChange={value => onChange({ planPayDate: value })}
                        >
                          {this.statusOption.map(item => <Select.Option key={item.key}>{item.label}</Select.Option>)}
                        </Select>
                      </CompactInput>
                    )}
                  </WrapFormItem>
                )}
              </Form.Item>
              <Form.Item
                label={messages('finance-1.key535')/*重复付款风险提示*/}
                {...formItemLayout}
              >
                {getFieldDecorator("repaymentRisk", {
                  initialValue: record.hasOwnProperty('repaymentRiskTip') ? {
                    repaymentRiskTip: record.repaymentRiskTip ? record.repaymentRiskTip.map(item => item + '') : [],
                    repaymentRiskDay: record.repaymentRiskDay
                  } : {
                    repaymentRiskTip: [],
                    repaymentRiskDay: undefined
                  }
                })(
                  <WrapFormItem>
                    {(onChange, value) => (
                      <div>
                        <Checkbox.Group
                          value={value.repaymentRiskTip}
                          onChange={val => onChange({ repaymentRiskTip: val, repaymentRiskDay: value.repaymentRiskDay || 1 })}
                        >
                          <Checkbox value='1'>{messages('finance-1.key536')/*员工收款方启用*/}</Checkbox>
                          <Checkbox value='2'>{messages('finance-1.key537')/*供应商收款方启用*/}</Checkbox>
                        </Checkbox.Group>
                        <div className='ant-form-extra'>
                          {messages('finance-1.key538')/*启用后，付款工作台确认支付时，若存在符合条件的数据，则会弹出风险提示消息，点击确认才会继续执行支付操作*/}
                        </div>
                        {
                          value.repaymentRiskTip && value.repaymentRiskTip.length > 0 && (
                            <div style={{marginTop: '12px'}}>
                              <InputNumber
                                value={value.repaymentRiskDay}
                                min={1}
                                step={1}
                                precision={0}
                                onChange={val => onChange({ repaymentRiskDay: val })}
                              />
                              {messages('finance-1.key539')/*天内存在相同金额相同收款方的支付中或已支付数据*/}
                            </div>
                          )
                        }
                      </div>
                    )}
                  </WrapFormItem>
                )}
              </Form.Item>
              <h3 className='sub-title'>{messages('finance-1.key419')/*付款流程管控*/}</h3>
              <Form.Item
                label={messages('finance-1.key262')/*线上付款复核*/}
                {...formItemLayout}
                extra={messages('finance-1.key420')/*线上付款组批后， 需复核通过后，方可进行银企直联/企业支付宝支付*/}
              >
                {getFieldDecorator("isPayCheck", {
                  rules: [{ required: true }],
                  initialValue: record.hasOwnProperty('isPayCheck') ? record.isPayCheck : false
                })(
                  <Radio.Group options={[
                    { label: messages('finance-1.key244')/*启用*/, value: true },
                    { label: messages('finance-1.key266')/*不启用*/, value: false }
                  ]}/>
                )}
              </Form.Item>
              <Form.Item
                label={messages('finance-1.key423')/*复核启用条件*/}
                {...formItemLayout}
              >
                <div className={'ant-form-extra'}>{messages('finance-1.key424')/*启用线上付款复核的具体条件*/}</div>
                <div>
                  <Button
                    type='primary'
                    style={{ margin: '8px 0' }}
                    onClick={() => this.handleAddLoanMax({ frontId: this.getRandomId() })}
                  >{messages('common.create')/*新建*/}</Button>
                </div>
                <ResizeTable
                  columns={[
                    { title: messages('finance-1.key425')/*收款账户类型*/, dataIndex: 'accountMark',
                      render: value => value ? (value === '01' ? messages('finance-1.key426')/*对私支付*/ : messages('finance-1.key427')/*对公支付*/) : '-' },
                    { title: messages('finance-1.key428')/*单笔金额超*/, dataIndex: 'singleAmountMax' },
                    { title: messages('finance-1.key429')/*批次总金额超*/, dataIndex: 'totalAmountMax' },
                    { title: messages('common.column.status')/*状态*/, dataIndex: 'isEnabled',
                      render: value => value ? <Badge text={messages('finance-1.key244')/*启用temp*/} status={'success'}/> :
                        <Badge text={messages('finance-1.key245')/*禁用temp*/} status={'error'}/>
                    }
                  ]}
                  dataSource={data}
                  onRow={record => ({
                    onClick: () => this.handleAddLoanMax(record)
                  })}
                  size="middle"
                  bordered
                  rowKey={record => record.frontId}
                />
              </Form.Item>
              <Form.Item
                label={messages('finance-1.key421')/*线上退票复核*/}
                {...formItemLayout}
                extra={messages('finance-1.key422')/*线上支付流水发生退票时，需复核通过后，方标记为付款退票*/}
              >
                {getFieldDecorator("isRefundCheck", {
                  rules: [{ required: true }],
                  initialValue: record.hasOwnProperty('isRefundCheck') ? record.isRefundCheck : false
                })(
                  <Radio.Group options={[
                    { label: messages('finance-1.key244')/*启用*/, value: true },
                    { label: messages('finance-1.key266')/*不启用*/, value: false }
                  ]}/>
                )}
              </Form.Item>
              <Form.Item
                label={messages('finance-1.key520')/*回单上传*/}
                {...formItemLayout}
                extra={messages('finance-1.key521')/*启用后，可以在付款工作台手工上传和查看银行回单信息*/}
              >
                {getFieldDecorator("isReceiptUpload", {
                  rules: [{ required: true }],
                  initialValue: record.isReceiptUpload ? record.isReceiptUpload + '' : '0'
                })(
                  <Radio.Group options={[
                    { label: messages('finance-1.key540')/*支付成功+支付中启用*/, value: '2' },
                    { label: messages('finance-1.key541')/*支付成功启用*/, value: '1' },
                    { label: messages('finance-1.key266')/*不启用*/, value: '0' }
                  ]}/>
                )}
              </Form.Item>
              <Form.Item
                label={messages('finance-1.key522')/*单据关联回单*/}
                {...formItemLayout}
                extra={messages('finance-1.key523')/*启用后，当支付流水关联了回单信息时，会同步将回单信息推送到已付款的单据上*/}
              >
                {getFieldDecorator("isBillRelateReceipt", {
                  rules: [{ required: true }],
                  initialValue: record.hasOwnProperty('isBillRelateReceipt') ? record.isBillRelateReceipt : false
                })(
                  <Radio.Group options={[
                    { label: messages('finance-1.key244')/*启用*/, value: true },
                    { label: messages('finance-1.key266')/*不启用*/, value: false }
                  ]}/>
                )}
              </Form.Item>
            </Condition.Else>
          </Condition>
          <div className='footer-operate'>
            <Button type='primary' onClick={this.handleSave} loading={saveLoading}>{messages('common.ok')/*确定*/}</Button>
            <Button onClick={() => close()}>{messages('common.cancel')/*取消*/}</Button>
          </div>
        </Form>
        <RecheckModal
          visible={visible}
          record={loanMaxRecord}
          cancel={() => this.setState({ visible: false })}
          onOk={this.onOk}
        />
      </div>
    )
  }

}

export default Form.create()(SaveHoc(PayBasicRule))
